//
//  NewSYPhotoBViewController.m
//  CooperLinker
//
//  Created by 洪雯 on 16/4/13.
//  Copyright © 2016年 洪雯. All rights reserved.
//

#import "NewSYPhotoBViewController.h"
#import "MainMapViewController.h"
#import "DetaileViewController.h"
#import "HomeViewController.h"

#define iphone4 (CGSizeEqualToSize(CGSizeMake(320, 480), [UIScreen mainScreen].bounds.size))
#define iphone5 (CGSizeEqualToSize(CGSizeMake(320, 568), [UIScreen mainScreen].bounds.size))
#define iphone6 (CGSizeEqualToSize(CGSizeMake(375, 667), [UIScreen mainScreen].bounds.size))
#define iphone6plus (CGSizeEqualToSize(CGSizeMake(414, 736), [UIScreen mainScreen].bounds.size))
@interface NewSYPhotoBViewController ()
{
    int _FontSIZE;
}

@property (nonatomic, strong)UITextView *textView;
@end

@implementation NewSYPhotoBViewController

- (void)viewWillAppear:(BOOL)animated
{
    self.tabBarController.tabBar.hidden = YES;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    float num = [self BackTimeNUMY];
    self.textView = [[UITextView alloc] initWithFrame:CGRectMake(10, self.view.frame.size.height - 180*num, self.view.frame.size.width-20, 78)];
    self.textView.backgroundColor = [UIColor clearColor];
    self.textView.text = _userInfo;
    self.textView.textColor = [UIColor whiteColor];
    self.textView.editable = NO;
    [self.view addSubview:self.textView];
    
    UIButton *btnMap = [[UIButton alloc] initWithFrame:CGRectMake(10, self.view.frame.size.height - 80*num, 30, 30)];
    btnMap.backgroundColor = [UIColor clearColor];
    [btnMap setImage:[UIImage imageNamed:@"MapLogo"] forState:UIControlStateNormal];
    [btnMap addTarget:self action:@selector(ButClcik) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:btnMap];
    
    UILabel * juLiLabel = [[UILabel alloc] initWithFrame:CGRectMake(50,self.view.frame.size.height - 80*num , 100, 30)];
    juLiLabel.backgroundColor = [UIColor clearColor];
    juLiLabel.text = _juLi;
    juLiLabel.font = [UIFont systemFontOfSize:12];
    juLiLabel.textColor = [UIColor redColor];
    [self.view addSubview:juLiLabel];
    
    UIButton * moreBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.view.frame.size.width - 100*num, self.view.frame.size.height - 80*num, 100, 30)];
    moreBtn.backgroundColor = [UIColor clearColor];
    [moreBtn setTitle:@"更多" forState:UIControlStateNormal];
    moreBtn.titleLabel.font = [UIFont systemFontOfSize: 12.0];
    [moreBtn setTitleColor:[UIColor redColor]forState:UIControlStateNormal];
    [moreBtn addTarget:self action:@selector(moreBtnClick) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:moreBtn];
    
}

- (void)ButClcik {
    MainMapViewController *mapView = [[MainMapViewController alloc]init];
    mapView.uuid = self.uid;
    //UINavigationController *nc = [[UINavigationController alloc] initWithRootViewController:mapView];
    //[self presentViewController:nc animated:YES completion:nil];
    [self.navigationController pushViewController:mapView animated:YES];
}

- (void)moreBtnClick
{
    DetaileViewController * detaileVC = [[DetaileViewController alloc] init];
    
}

//- (void)selectDetaileViewController:(UIViewController *)detaileViewController title:(NSString *)title 
//{
//    detaileViewController.title = title;
//}

- (float)BackTimeNUMY {
    float numY = 0.0;
    if (iphone4) {
        numY = 480 / 667.0;
        _FontSIZE = -2;
        return numY;
    }
    if (iphone5) {
        numY = 568 / 667.0;
        _FontSIZE = -2;
        return numY;
    }
    if (iphone6) {
        _FontSIZE = 0;
        return 1.0;
    }
    if (iphone6plus) {
        numY = 736 / 667.0;
        _FontSIZE = 2;
        return numY;
    }
    return numY;
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/
//#pragma mark 每滑动一次的代理事件
//- (void)pageViewController:(UIPageViewController *)pageViewController willTransitionToViewControllers:(NSArray<UIViewController *> *)pendingViewControllers {
////    self.pageControl.currentPage = ((SYPhotoViewController *)pendingViewControllers.lastObject).pageIndex;
////    self.initialPageIndex
//    NSLog(@"----->%lu",(unsigned long)self.pageIndex);
//    
//}

- (void)fun:(NSUInteger)intage {
    if (self.infoArry.count > intage && self.infoArry[intage]) {
        self.textView.text = self.infoArry[intage];
    }
}

@end
